<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <meta name="description" content="">
  <meta name="author" content="ThemeBucket">
  <link rel="shortcut icon" href="#" type="image/png">

  <title>下载记录</title>

  <!--data table-->
  <link rel="stylesheet" href="js/data-tables/DT_bootstrap.css" />

    <div th:include="common :: commonheader"></div>
</head>

<body class="sticky-header">

<section>
    <!-- left side start-->
    <div th:replace="common::#leftmenu"></div>
    <!-- left side end-->
    
    <!-- main content start-->
    <div class="main-content" >

        <!-- header section start-->
        <div th:replace="common::header-section"></div>
        <!-- header section end-->

        <!-- page heading start-->
        <div class="page-heading">
            <h3>
                下载记录
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">首页</a>
                </li>
                <li class="active"> 下载记录 </li>
            </ul>
        </div>
        <!-- page heading end-->

        <!--body wrapper start-->
        <div class="wrapper">
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">
                        <header class="panel-heading">
                            详细情况
                            <span class="tools pull-right">
                     </span>
                        </header>
                        <div class="panel-body">
                            <div class="adv-table editable-table ">
                                <div class="clearfix">
                                </div>
                                <div class="space15"></div>
                                <table class="table table-striped table-hover" id="" aria-describedby="">
                                    <thead>
                                    <tr role="row">
                                        <th>#</th>
                                        <th>文件名</th>
                                        <th>下载时间</th>
                                        <th>下载路径</th>
                                        <th>下载情况</th>
                                        <th>清除记录</th>
                                    </tr>
                                    </thead>

                                    <tbody role="alert" aria-live="polite" aria-relevant="all" id="table_body">
                                    <tr class="odd">
                                        <td class="" style="width:10px;height: 10px;">
                                            <input type="checkbox">
                                        </td>
                                        <td class="sorting_1">Aishmen</td>
                                        <td class=" "> Samuel</td>
                                        <td class=" ">435</td>

                                        <td class=" ">
                                            <a class="delete" href="javascript:;">delete</a>
                                        </td>

                                    </tr>
                                    </tbody></table>

                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </div>
        <!--body wrapper end-->

        <!--footer section start-->
        <footer>
            2020 &copy; AdminEx by ThemeBucket </a>
        </footer>
        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>

<!-- Placed js at the end of the document so the pages load faster -->
<div th:replace="common :: #commonscript"></div>

<!--data table-->
<script type="text/javascript" src="js/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="js/data-tables/DT_bootstrap.js"></script>


<!--script for editable table-->
<script src="js/editable-table.js"></script>

<!-- END JAVASCRIPTS -->
<script>
    // jQuery(document).ready(function() {
    //     EditableTable.init();
    // });
    $(function(){
        var com = document.location.origin+"/";
        $.ajax({
            url: com+"downloadRecord/",
            type:"POST",
            success:function(result){
                var datas = result.extend.data;
                var table_body = $("#table_body")
                table_body.empty()
                create_trData(datas,table_body)
            }
        })

        // 创建tr节点的函数
        var create_trData = function(datas,tableId){
            if (datas===null){
                return;
            }
            // var index = 0;
            datas.forEach(data => {
                var input = $('<td class="" style="width:10px;height: 10px;"><input type="checkbox" name=""></td>').attr("index",data.downId)
                var fileName = $("<td></td>").append(data.fileName)
                var downTime = $("<td></td>").append(data.downTime)
                var downPath = $("<td></td>").append(data.downPath)
                var downStatus = $("<td></td>").append( data.downStatus )
                var optionDelete = $("<a href='javascript:;'></a>").attr("class","delete").append("删除")
                var option = $("<td></td>").append(optionDelete)

                var tr = $('<tr></tr>').append(input).append(fileName).append(downTime).append(downPath).append(downStatus).append(option)
                tableId.append(tr)
            })
        }

    })



</script>

</body>
</html>
